package com.paradogs.demo.logic.controller;

import com.paradogs.demo.logic.misc.PlayerOnlineHolder;
import com.paradogs.demo.logic.misc.PlayerTemplate;
import com.paradogs.demo.logic.pojo.cg.InventoryGain;
import com.paradogs.framework.core.annoations.request.PRController;
import com.paradogs.framework.core.annoations.request.PRMsgMapping;
import com.paradogs.framework.core.msg.PRMsgContextHolder;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author: yumi
 * @date: 2023/12/12  13:55
 * @Description: TODO
 */
@PRController
@PRMsgMapping("inventory")
public class InventoryController {

    @Autowired
    private PlayerOnlineHolder playerOnlineHolder;

    /**
     * 获取物品测试
     */
    @PRMsgMapping("addItem")
    public void addItem(InventoryGain gain) {
        PlayerTemplate player = playerOnlineHolder.getPlayer(PRMsgContextHolder.getPlayerId());
        player.getInventoryManager().addItem(gain.getItemId(), gain.getCount());
    }

}
